
import us = module("main/org/sdmx/model/v2/base/type/UsageStatus");
import xac = module("main/org/sdmx/model/v2/base/structure/XSAttachableComponent");
import cpt = module("main/org/sdmx/model/v2/structure/concept/Concept");


/**
	* An abstract class used to provide qualitative information.
	* 
	* @author Xavier Sosnovsky, Anthony Morel
	* 
	* @see org.sdmx.model.v2.base.type.UsageStatus
	*/ 
export class Attribute extends xac.XSAttachableComponent {

	/*==============================Fields================================*/
		
	private _usageStatus:string;
		
	/*===========================Constructor==============================*/

	/**
		* Constructs an attribute.
		*  
		* @param identifier The attribute id
		* @param conceptIdentity The concept representing the attribute (for
		* example, the attribute OBS_CONF represents the concept of an 
		* observation confidentiality).
		*/
	constructor(identifier:string, conceptIdentity:cpt.Concept) {
		super(identifier, conceptIdentity);
	}
		
	/*============================Accessors===============================*/
		
	/**
	 	* @private 
	 	*/
	public setUsageStatus(usageStatus:string) {
		if (!us.UsageStatus.contains(usageStatus)) {
			throw new Error(usageStatus + 
				" is not a valid SDMX usage status");
		} else {
			this._usageStatus = usageStatus;
		}
	}
		
	/**
		* The usage status (Mandatory or Conditional) of the attribute. 
		* 
		* @throws TypeError <code>TypeError</code>: If the supplied usage 
		* status is not in the list of valid SDMX status.
		*/
	public getUsageStatus():string {
		return this._usageStatus;
	}
}